package File;

import java.io.*;
//利用PrintWriter搭配OutputStream
public class Demo11 {
    public static void main(String[] args) throws IOException {
        try(OutputStream outputStream = new FileOutputStream("./output.txt",true)){
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream,"utf8");
            PrintWriter printWriter = new PrintWriter(outputStreamWriter);
            //通过printf、println写入
            printWriter.print("Hello");
            printWriter.println("你好");
            printWriter.printf("%d: %s\n", 1, "没什么");
            printWriter.flush();
        }

    }
}
